package com.wanfu.controller;

import com.wanfu.entity.User;
import com.wanfu.service.UserService;
import com.wanfu.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/register")
    @ResponseBody
    public Object register(String mobile,String userName, String password) throws Exception {
        User user = userService.register(mobile, userName, password);
        if (user != null)
            return Result.ok(user);
        return Result.error();
    }
}
